<style>
    form{width: 300px; margin: 100px auto; border: 1px solid #ddd;padding: 30px;}
    .form-item{margin-bottom: 20px;}
    .label{margin-bottom: 10px}
    .input-item input{width: 300px; border: 1px solid #ccc; padding: 5px;}
    button{width: 300px; background-color: red;color: #fff; border: none; padding: 5px 0}
</style>
<form action="">
    <div class="form-item">
        <div class="label">用户名</div>
        <div class="input-item"><input type="text" id="username" name="username"></div>
    </div>
    <div class="form-item">
        <div class="label">密码</div>
        <div class="input-item"><input type="text" id="password" name="password"></div>
    </div>
    <div>
        <button type="button" onclick="login()">立即登录</button>
    </div>
</form>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script>
    function login() {
        var params = {
            username: jQuery('#username').val(),
            password: jQuery('#password').val()
        }
        jQuery.post('/index.php?c=user&a=doLogin', params, function (data){
            console.log(params)
        }, 'json')
    }
</script>